﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LinQProject;
using ServiceProject.EntityService;

public partial class controls_ucProductSaptamana : System.Web.UI.UserControl
{
    private static readonly FarmacieDataClassesDataContext database = new FarmacieDataClassesDataContext();
    protected ProductService prodService = new ProductService(database);

    public int ProductId
    {
        get
        {
            int intValue;
            if (Int32.TryParse(hdnProductId.Value, out intValue))
            {
                return intValue;
            }
            return -1;
        }
        set { hdnProductId.Value = value.ToString(); }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            LoadControls();
    }

    public void LoadControls()
    {
        Product itemProduct = prodService.GetProductById(ProductId);
        img.ImageUrl ="~/" + itemProduct.ProductPicturePath;
        txt.Text = itemProduct.ProductDescription;
    }
}
